var app = new Vue({
    el: '#app',
    data: {
        apiIndexUrl: "api/sys/index/info",
        menuUrl: "api/sys/index/menuCol",
        menuData:{},
        info: {
            "aboutAs": {
                "id": "1",
                "createDate": 1536035891000,
                "describe": "​STARSEA株式会社是瑞麦（RE/MAX）在东京的第7家合作公司，位于人气的新宿区域，致力于为华人提供优质的地产投资项目和海外投资咨询服务。",
                "thumbnail": "/star_house/userfiles/fileupload/201809/1042411037036744704.png",
                "title": "关于他们"
            },
            "houses": [
                {
                    "id": "1",
                    "addr": "東京都中央区晴海 3-13-2",
                    "houseType": 1,
                    "houseTypeStr": "三室一厅",
                    "pics": "/star_house/userfiles/fileupload/201809/1036854169013342208.jpg|/star_house/userfiles/fileupload/201809/1036957067727409152.jpg|/star_house/userfiles/fileupload/201809/1036854167641804800.jpg|/star_house/userfiles/fileupload/201809/1036854228006227968.jpg|/star_house/userfiles/fileupload/201809/1036854165888585728.jpg",
                    "price": 11200.0,
                    "priceUnit": 6,
                    "priceUnitStr": "日元",
                    "title": "东京中央区人气高层公寓Deux Tours 2905"
                },
                {
                    "id": "1",
                    "addr": "東京都中央区晴海 3-13-2",
                    "houseType": 1,
                    "houseTypeStr": "三室一厅",
                    "pics": "/star_house/userfiles/fileupload/201809/1036854169013342208.jpg|/star_house/userfiles/fileupload/201809/1036957067727409152.jpg|/star_house/userfiles/fileupload/201809/1036854167641804800.jpg|/star_house/userfiles/fileupload/201809/1036854228006227968.jpg|/star_house/userfiles/fileupload/201809/1036854165888585728.jpg",
                    "price": 11200.0,
                    "priceUnit": 6,
                    "priceUnitStr": "日元",
                    "title": "东京中央区人气高层公寓Deux Tours 2905"
                },
            ],
            "infoMations": [],
            "news": [],
            "pics": [],
        }
    },
    mounted: function () {
        this.getCustomers();
    },
    updated: function () {//数据加载完触 发
        //加载完图片，开始处理轮播
        this.swiperStart();
        menu_hover();
    },
    methods: {
        getCustomers: function () {//初始数据
            this.$http.get(baseUrl + this.apiIndexUrl).then(
                function (res) {
                    this.info = res.data.data;
                }
            ).catch(function (response) {
                console.log(response)
            })
            this.$http.get(baseUrl + this.menuUrl).then(
                function (res) {
                    this.menuData = res.data.data;
                }
            ).catch(function (response) {
                console.log(response)
            })
        },
        swiperStart: function () {//轮播图片处理
            //轮播图启动
            var mySwiper = new Swiper('.swiper-container', {
                loop: true,
                autoplay: true,
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true
                },
            });
        }
    },
    filters: {
        formatDate: function (val) {
            var value = new Date(val);
            var year = value.getFullYear();
            var month = padDate(value.getMonth() + 1);
            var day = padDate(value.getDate());
            /*var hour = padDate(value.getHours());
            var minutes = padDate(value.getMinutes());
            var seconds = padDate(value.getSeconds());*/
            return year + '-' + month + '-' + day;
        }
    }
})

